package com.banyuan;

import java.io.*;

public class CopyFile {
    public static void main(String[] args) {
        InputStream is = null;   //读
        OutputStream os = null;  // 写
        try {
            long startTime = System.currentTimeMillis();
            is = new FileInputStream("/Users/edy/Desktop/file/jdk-8u321-windows-x64.exe");
            os = new FileOutputStream("/Users/edy/Desktop/file/yzt.exe");
            byte[] bytes = new byte[1024 * 1024];
            int len;
            while ((len = is.read(bytes)) > 0) {
                os.write(bytes,0,len);
            }
            long stopTime = System.currentTimeMillis();
            System.out.println(stopTime - startTime);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            IOUtilis.closeQuiety(os);
            IOUtilis.closeQuiety(is);
        }

    }
}
